Conversation
Fix modernize warnings in find_if calls. Fix unused include warning. Fix passing const values by value. Fix marking nodiscard warning Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Remove unused CPackIFW and CTest include statements, this solves #18. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Calling this method(remove) on Ethernet devices, hidden WiFi services or provisioned services will cause an error message. It is not possible to remove these kind of services. https://git.kernel.org/pub/scm/network/connman/connman.git/tree/doc/ service-api.txt#n98 Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Iterate all the test files in the CMake configuration in order to remove duplicated code. Define a class that iterates the global default context simulating what Qt libraries does. The latter class saves the thread id where the object is created and the thread id where the global default context it is iterated. Use the class on the tests to check that callbacks are not run on the main thread nor in the thread iterating the global default context. This helps to test the issue presented in #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the DBus communication layer to ensure thread safety by executing GDBus operations within a dedicated GMainContext. Key changes include the introduction of a stop() method for clean shutdown, the use of std::ranges in examples, and a significant update to DBusProxy and Agent to synchronize object registration and method calls with the GLib main loop. Feedback suggests making the connectSignal method synchronous to prevent potential dangling pointer issues during initialization and marking the context() getter as const.
|
🧩 Build Artifacts ✅ The following build artifacts were produced: |
Create a thread default context and iterate the later on the worker thread. This solves #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Wrap the callMethod method inside a g_main_context_invoke. The latter makes that the callbacks are executed in the worker thread provided by the library. This solves #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Add a stop method that will try to stop the context iteration and wait for the thread to join. Improve start method to be able to be called many times in conjunction with the stop method. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
The proxies has to be destroyed before the context, because the context have to be iterated later to free some weak ref inside the proxy. https://gitlab.gnome.org/GNOME/glib/-/issues/3926 Stop dbus thread before destroying manager to avoid any callback accessing invalid memory. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Initialize the glib proxy member in the worker thread and connect the signals in the worker thread. All this make the callbacks of the connected signals to run on the worker thread. The creation of the proxy is blocked until the worker thread creates it. This solves #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
This solves #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Call the register object in the dbus in the worker thread. The latter makes the callback to be executed also in the worker thread. The creation of the agent block the thread until the worker thread register the object. This solves #21. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Remove the use of the LCM_LOG_DEFAULT_ENABLED compile definition. LCM_LOG has to be enable always at runtime. Enable LCM_LOG at runtime for the tests and the example. This solves #24. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
|
🧩 Build Artifacts ✅ The following build artifacts were produced: |
Store a pointer to dbus to finish the request input in the gdbus managed context. Spawn a thread that execute the request input callback so the user can block as long as he wants for user input. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
A lock is used to protect concurrent access to the services structure, once the service is found there is no need to continue locking the resource. The later allows to block the request input as long as the user want without locking the services and other members of the manager. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
Unref missing GPtrArray memory and add function to properly free field description structs. Signed-off-by: Eduardo Gonzalez <eduardo.gonzalez@amarulasolutions.com>
|
🧩 Build Artifacts ✅ The following build artifacts were produced: |
The Pr fixes the issues #18, #21, #24 .
Fixes clang warnings and unused imports and remove duplicated code, improving the code quality.
Also address #21 making that all the callbacks are always run in the worker thread of the library following Glib best practices.
The changes related to this issue does not change the public API of the library but they force to always run the callback in a defined thread. Because of that, I would keep the same major version number of the library if these changes are applied.